#pragma once

#ifndef searchTaobao_h__
#define searchTaobao_h__

#include "Task.h"
#include "Item.h"

void searchTaobao(const QVariantMap &arg);
void searchTmall(const QVariantMap &arg);
void searchTBcc(const QVariantMap &arg);

enum class SearchMethod;
class TaskManager;
class Item;
class ItemsSearcher : public Task
{
    Q_OBJECT;
public:
    ItemsSearcher(TaskManager *manager);
public:
    void start();
    void askForNextSearch();
public:
    bool isSearchFinished();
public:
    void taobaoIndexOpened(QVariantMap arg);
    void searchResultShown(QVariantMap arg);
    void mainItemFound(QVariantMap arg);
    void compareItemSelected(QVariantMap arg);
    void _itemUpdated(QVariantMap arg);
    void itemsFound(QVariantMap arg);
signals:
    void itemUpdated(Item item);
public:
    QString itemKeyword;
    QString itemLowerPrice;
    QString itemHigherPrice;
    QString sortBy;
    QString itemTitle;
    QString itemPrice;
    QString itemShopName;
    QString location;
    QString itemId;
    SearchMethod searchMethod;
    bool sendItemSelectedCapture;
    QString supportKeyword;
private:
    TaskManager *manager = nullptr;
};

#endif // searchTaobao_h__
